<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ShareB.Models.PublicationModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	ViewMyPub
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>ViewMyPub</h2>

    <fieldset>
        <legend>Information</legend>
        <table>

        <tr>
            <th>
                <div class="display-label">UserID</div>
            </th>
            <td>
                <div class="display-field"><%: Model.UserID %></div>
            </td>
        </tr>

        <tr>
            <th>
                <div class="display-label">Username</div>
            </th>
            <td>
                <div class="display-field"><%: Model.Username %></div>
            </td>
        </tr>
        
       
        <tr>
            <th>      
                <div class="display-label">StartDate</div>
            </th>
            <td>
                <div class="display-field"><%: String.Format("{0:g}", Model.StartDate) %></div>
            </td>
        </tr>

        <tr>
            <th> 
                <div class="display-label">Tittle</div>
            </th>
            <td>
                <div class="display-field"><%: Model.Tittle %></div>
             </td>
        </tr>

        <% for (int i = 0; i < Model.Fields.Count; i++)
               { %>
                    <tr>
                        <th>
                        <%: Html.DisplayFor(model => model.Fields[i].FieldName) %>
                        </th>
                        <td colspan = "5">
                        <%: Html.DisplayFor(model => model.Fields[i].FieldValue)%>                        
                        </td>
                    </tr>
                    <!-- Hidden fields to preserve information -->
                    <%: Html.HiddenFor(model => model.Fields[i].FieldName)%>
                    <%: Html.HiddenFor(model => model.Fields[i].MetaFieldID)%>
            <% } %>

        </table>

        </fieldset>

        <fieldset>
            <legend>Classifications</legend>
        
        <table>
        <% for (int i = 0; i < Model.Classif.Count; i++)
               { %>
               <tr>
                    <td>
                        <div class="display-label">User - <%: Model.Classif[i].UserID %></div>
                    </td>
                     <td>
                        <% if( Model.Classif[i].Classification == 0 )
                            { %>
                            <div class="display-field">Classification: Without pontuation </div>
                        <% } else
                            { %>
                            <div class="display-field">Classification: <%: Model.Classif[i].Classification %></div>
                        <% } %>
                    </td>
                </tr>
            <% } %>
        </table>
        </fieldset>

        <fieldset>
            <legend>Pontuation</legend>
           
            <div class="editor-field">
             <table>
                <tr>
                    <td>
                    <%: Html.Label("Your Pontuation:") %>
                    </td>
                    <% using (Html.BeginForm("ViewMyPubTemp","Publication", FormMethod.Post, new { id = "myform" })) { %>
                    <td>
                    <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, 1, new { @checked = "checked", @class = "radio" })%><label>1</label>
                    </td>
                    <td>
                    <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, 2,  new { @class = "radio" })%><label>2</label>
                    </td>
                    <td>
                    <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, 3,  new { @class = "radio" })%><label>3</label>
                    </td>
                    <td>
                    <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, 4,  new { @class = "radio" })%><label>4</label>
                    </td>
                    <td>
                    <%=Html.RadioButtonFor(model => model.ClassifAlone.Classification, 5, new { @class = "radio" })%><label>5</label>
                    </td>
                </tr>
                    <script type="text/javascript">
                        $(function () {
                            $('#myform .radio').change(function () {
                                $('#myform').submit();
                            });
                        });
                    </script>

                    <%: Html.HiddenFor(model => Model.Fields)%>
                    <%: Html.HiddenFor(model => Model.UserID)%>
                    <%: Html.HiddenFor(model => Model.PublicationID)%>
                    <%: Html.HiddenFor(model => Model.PubConfID)%>
                    <%: Html.HiddenFor(model => Model.Tittle)%>
                    <%: Html.HiddenFor(model => Model.Classif)%>

            </table>
                    <input type="submit" name="Submit" value="Save" />
                    <% } %>

                 
            </div>
         </fieldset>

    <p>
        <%: Html.ActionLink("Back to List", "ViewAllMyPub", "Publication")%>
    </p>

</asp:Content>

